package vn.com.bookstore.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import vn.com.bookstore.dao.AudioBookDao;
import vn.com.bookstore.domain.model.AudioBook;
import vn.com.bookstore.domain.model.PagingInfo;
import vn.com.bookstore.domain.model.SearchResult;

@Service
public class AudioBookServiceImpl implements AudioBookService {

	@Autowired
	private AudioBookDao audioBookDao;
	
	@Override
	public SearchResult<AudioBook> getAudioBook(PagingInfo pagingInfo) {
		return audioBookDao.getAudioBooks(pagingInfo);
	}
	
	@Override
	public SearchResult<AudioBook> getAudioBookWithKeyWord(String keyword, PagingInfo pagingInfo) {
		return audioBookDao.getAudioBookWithKeyWord(keyword, pagingInfo);
	}

	@Override
	public AudioBook getAudioBookById(int id) {
		return audioBookDao.getAudioBookByid(id).getSearchResult().get(0);
	}

}
